package com.sheep.api.HDFS.service.impl;

import com.sheep.api.HDFS.HDFSFileService;
import com.sheep.util.HDFSFileSupport;
import org.apache.log4j.Logger;

/**
 * Created by Administrator on 2016/3/28.
 */
@org.springframework.stereotype.Service
@com.alibaba.dubbo.config.annotation.Service
public class HDFSFileServiceImpl implements HDFSFileService {
    private static final Logger logger = Logger.getLogger(HDFSFileServiceImpl.class);

    public boolean upLoadToCloud(String LOCAL_SRC, String CLOUD_DEST) {
        try{
            HDFSFileSupport.upLoadToCloud(LOCAL_SRC, CLOUD_DEST);
        }catch (Exception e){
            logger.error("上传文件失败:"+e.getMessage());
        }
        return true;
    }

    public boolean downFromCloud(String LOCAL_SRC, String CLOUD_DESC) {
        try{
            HDFSFileSupport.downFromCloud(LOCAL_SRC, CLOUD_DESC);
        }catch (Exception e){
            logger.error("下载文件失败:"+e.getMessage());
        }
        return true;
    }

    public boolean isExist(String CLOUD_DESC) {
        return HDFSFileSupport.isExist(CLOUD_DESC);
    }

    public boolean renameFile(String src, String dst) {
        HDFSFileSupport.renameFile(src, dst);
        return true;
    }

    public boolean deleteFile(String src) {
        HDFSFileSupport.deleteFile(src);
        return true;
    }
}
